home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / etc / bash_completion.d / p4 < prev    next >
Text File  |  2009-04-02  |  1KB  |  56 lines

  1. # -*- mode: shell-script; sh-basic-offset: 8; indent-tabs-mode: t -*-
  2. # ex: ts=8 sw=8 noet filetype=sh
  3. #
  4. # Perforce completion by Frank Cusack <frank@google.com>
  5.  
  6. _p4()
  7. {
  8.     local cur prev prev2 p4commands p4filetypes
  9.  
  10.     COMPREPLY=()
  11.     cur=`_get_cword`
  12.     prev=${COMP_WORDS[COMP_CWORD-1]}
  13.  
  14.     # rename isn't really a command
  15.     p4commands="$( p4 help commands | awk 'NF>3 {print $1}' )"
  16.     p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \
  17.         uresource uxbinary xbinary xltext xtempobj xtext \
  18.         text binary resource"
  19.  
  20.     if [ $COMP_CWORD -eq 1 ]; then
  21.         COMPREPLY=( $( compgen -W "$p4commands" -- $cur ) )
  22.     elif [ $COMP_CWORD -eq 2 ]; then
  23.         case "$prev" in
  24.         help)
  25.             COMPREPLY=( $( compgen -W "simple commands \
  26.                 environment filetypes jobview revisions \
  27.                 usage views $p4commands" -- $cur ) )
  28.             ;;
  29.         admin)
  30.             COMPREPLY=( $( compgen -W "checkpoint stop" -- $cur ) )
  31.             ;;
  32.         *)
  33.             ;;
  34.         esac
  35.     elif [ $COMP_CWORD -gt 2 ]; then
  36.         prev2=${COMP_WORDS[COMP_CWORD-2]}
  37.         case "$prev" in
  38.         -t)
  39.             case "$prev2" in
  40.             add|edit|reopen)
  41.                 COMPREPLY=( $( compgen -W "$p4filetypes" \
  42.                            -- $cur) )
  43.                 ;;
  44.             *)
  45.                 ;;
  46.             esac
  47.             ;;
  48.         *)
  49.             ;;
  50.         esac
  51.     fi
  52.  
  53.     return 0
  54. }
  55. complete -F _p4 $default p4 g4
  56.